package Fabricas;

import Interfaces.IComentario;
import Interfaces.IJuego;
import Interfaces.IPerfil;
import Interfaces.IVersion;
import Interfaces.IWeb;
import Logica.ServidorCentral;

public class Factory {
    
    private static Factory instance = null;
    private String direccionBD = null;

    public Factory() {}
    
    private Factory(String direccionBD){
    
        this.direccionBD = direccionBD;
    
    }
    
    public static synchronized Factory getInstance(String direccionBD){
    
        if(instance == null){
        
            instance = new Factory(direccionBD);
        
        }
        
        return instance;
    
    }
    
    public IPerfil getIPerfil() throws Exception{
    
        IPerfil IP = new ServidorCentral(direccionBD);
        return IP;
    
    }
    
    public IJuego getIJuego() throws Exception{
    
        IJuego IJ = new ServidorCentral(direccionBD);
        return IJ;
    
    }
    
    public IComentario getIComentario() throws Exception{
    
        IComentario IC = new ServidorCentral(direccionBD);
        return IC;
    
    }
    
    public IVersion getIVersion() throws Exception{
    	
    	IVersion IV = new ServidorCentral(direccionBD);
    	return IV;
    	
    }
    
    public IWeb getIWeb() throws Exception{
    	
    	IWeb IW = new ServidorCentral(direccionBD);
    	return IW;
    	
    }
    
}
